-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][broker] Improve retention
endpoint to pure async.
#17496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Policies policies = namespaceResources().getPolicies(namespaceName) | ||
.orElseThrow(() -> new RestException(Status.NOT_FOUND, | ||
"Namespace policies does not exist")); | ||
if (!checkQuotas(policies, retention)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can delete this method.
@@ -1195,12 +1195,16 @@ public void getRetention(@Suspended final AsyncResponse asyncResponse, | |||
@PathParam("namespace") String namespace) { | |||
validateNamespaceName(property, cluster, namespace); | |||
validateNamespacePolicyOperationAsync(namespaceName, PolicyName.RETENTION, PolicyOperation.READ) | |||
.thenCompose(__ -> getNamespacePoliciesAsync(namespaceName)) | |||
.thenAccept(policies -> asyncResponse.resume(policies.retention_policies)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why need to change this?
Motivation
Since Pulsar is a fully asynchronous project, we need to avoid using thread-blocking methods.
Also, we can see #14365
Modifications
validatePolicies
.Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below or label this PR directly.
Need to update docs?
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)